package sg.edu.nus.iss.vmcs.command;

import sg.edu.nus.iss.vmcs.customer.DispenseController;
import sg.edu.nus.iss.vmcs.util.VMCSException;

/**
 * 
 * @version 1.0
 * @author Qu Hui
 * 
 */
public class DispenseDrinkCmd implements Command {
	
	private DispenseController dispenseCtrl;
	
	public DispenseDrinkCmd(DispenseController dispenseCtrl) {
		this.dispenseCtrl = dispenseCtrl;
	}
	
	public void execute(Object o) throws VMCSException {
		if (o instanceof Integer) {
			Integer selectedBrand = (Integer) o;
			try {
				dispenseCtrl.dispenseDrink(selectedBrand);
			} catch (VMCSException e) {
				throw new VMCSException("DispenseDrinkCmd.execute", e.getMessage());
			}
		}
	}

}
